<!doctype html>
<html class="no-js" lang="">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <title>angular-oauth2-oidc</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <link rel="icon" type="image/x-icon" href="../images/favicon.ico">
	      <link rel="stylesheet" href="../styles/style.css">
    </head>
    <body>

        <div class="navbar navbar-default navbar-fixed-top visible-xs">
            <a href="../" class="navbar-brand">angular-oauth2-oidc</a>
            <button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>
        </div>

        <div class="xs-menu menu" id="mobile-menu">
                <div id="book-search-input" role="search"><input type="text" placeholder="Type to search"></div>            <compodoc-menu></compodoc-menu>
        </div>

        <div class="container-fluid main">
           <div class="row main">
               <div class="hidden-xs menu">
                   <compodoc-menu mode="normal"></compodoc-menu>
               </div>
               <!-- START CONTENT -->
               <div class="content additional-page">
                   <div class="content-data">














                   




<h1 id="events">Events</h1>
<p>The library informs you about its tasks and state using <a href="https://manfredsteyer.github.io/angular-oauth2-oidc/docs/injectables/OAuthService.html#events">events</a>.
This is an <code>Observable&lt;OAuthEvent&gt;</code> which publishes a stream of events as they occur in the service.
You can log these events to the console for debugging information.</p>
<p>A short snippet you could use:</p>
<div><pre class="line-numbers"><code class="language-TypeScript">this.oauthService.events.subscribe(e =&gt; console.log(e));</code></pre></div><p>Or a longer, more extensive version that logs them at different levels:</p>
<div><pre class="line-numbers"><code class="language-TypeScript">import { OAuthErrorEvent } from &#39;angular-oauth2-oidc&#39;;

// ...

this.authService.events.subscribe(event =&gt; {
  if (event instanceof OAuthErrorEvent) {
    console.error(event);
  } else {
    console.warn(event);
  }
});</code></pre></div><p>Here&#39;s a list of the main events you might encounter:</p>
<ul>
<li><code>discovery_document_loaded</code> is published whenever the service has retrieved the openid configuration and successfully saved the <code>jwks</code> information</li>
<li><code>invalid_nonce_in_state</code> is published during <code>tryLogin</code>, when an access token has been requested and the state check was not disabled via the options, only in case the nonce is not as expected (see OAuth2 spec for more details about the nonce)</li>
<li><code>user_profile_loaded</code> is published just before <code>loadUserProfile()</code> successfully resolves</li>
<li><code>token_received</code> is published whenever the requested token(s) have been successfully received and stored</li>
<li><code>silently_refreshed</code> is published when the silent refresh timer has gone off and the library has also successfully refreshed the tokens (only applicable to Implicit Flow)</li>
<li><code>silent_refresh_timeout</code> is published if the silent refresh timer has gone off but it takes too long to successfully refresh</li>
<li><code>session_error</code> will only be published if the session checks encounter an error</li>
</ul>
<p>For a full list of available events see the string based enum in <a href="https://github.com/manfredsteyer/angular-oauth2-oidc/blob/master/projects/lib/src/events.ts">the file <code>events.ts</code></a>.</p>

                   </div><div class="search-results">
    <div class="has-results">
        <h1 class="search-results-title"><span class='search-results-count'></span> result-matching "<span class='search-query'></span>"</h1>
        <ul class="search-results-list"></ul>
    </div>
    <div class="no-results">
        <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
    </div>
</div>
</div>
               <!-- END CONTENT -->
           </div>
       </div>

       <script>
            var COMPODOC_CURRENT_PAGE_DEPTH = 1;
            var COMPODOC_CURRENT_PAGE_CONTEXT = 'additional-page';
            var COMPODOC_CURRENT_PAGE_URL = 'events.html';
            var MAX_SEARCH_RESULTS = 15;
       </script>

       <script src="../js/libs/custom-elements.min.js"></script>
       <script src="../js/libs/lit-html.js"></script>
       <!-- Required to polyfill modern browsers as code is ES5 for IE... -->
       <script src="../js/libs/custom-elements-es5-adapter.js" charset="utf-8" defer></script>
       <script src="../js/menu-wc.js" defer></script>

       <script src="../js/libs/bootstrap-native.js"></script>

       <script src="../js/libs/es6-shim.min.js"></script>
       <script src="../js/libs/EventDispatcher.js"></script>
       <script src="../js/libs/promise.min.js"></script>
       <script src="../js/libs/zepto.min.js"></script>

       <script src="../js/compodoc.js"></script>

       <script src="../js/tabs.js"></script>
       <script src="../js/menu.js"></script>
       <script src="../js/libs/clipboard.min.js"></script>
       <script src="../js/libs/prism.js"></script>
       <script src="../js/sourceCode.js"></script>
          <script src="../js/search/search.js"></script>
          <script src="../js/search/lunr.min.js"></script>
          <script src="../js/search/search-lunr.js"></script>
          <script src="../js/search/search_index.js"></script>
       <script src="../js/lazy-load-graphs.js"></script>


    </body>
</html>
